#! /bin/sh

echo leakd - finds 'leaks' in your file system.
echo Copyright \(C\) Rixstep. All rights reserved.
echo
echo ' 1. File systems compiled into the running kernel'
echo -------------------------------------------------
sysctl -A vfs | grep -v '0 mounted' | sort
echo
echo ' 2. File systems compiled into the running system'
echo -------------------------------------------------
sysctl vfs | grep -v '0 mounted' | sort
echo
echo ' 3. Empty directories'
echo -------------------------------------------------
find -x / -type d -empty 2>/dev/null
echo
echo ' 4. Empty files'
echo -------------------------------------------------
find -x / -type f -empty 2>/dev/null
echo
echo ' 5. SGID files'
echo -------------------------------------------------
find -x / -type f -perm -02000 2>/dev/null
echo
echo ' 6. SGID root files'
echo -------------------------------------------------
find -x / -type f -perm -02000 -group 0 2>/dev/null
echo
echo ' 7. SUID files'
echo -------------------------------------------------
find -x / -type f -perm -04000 2>/dev/null
echo
echo ' 8. SUID root files'
echo -------------------------------------------------
find -x / -type f -perm -04000 -user 0 2>/dev/null
echo
echo ' 9. World-writable files'
echo -------------------------------------------------
find -x / -perm 2 -type f 2>/dev/null
echo
echo 10. Who\'s running
echo -------------------------------------------------
who /var/log/wtmp 2>/dev/null;who /var/run/utmp 2>/dev/null
